//
//  BBTabViewController.m
//  BearSiX
//
//  Created by Tom on 16/3/25.
//  Copyright © 2016年 Tom. All rights reserved.
//

#import "BBTabViewController.h"
#import "BBSelfViewController.h"
#import "BBFunctionViewController.h"
#import "BBMSGViewController.h"
#import "BBRemindViewController.h"
#import "BBYDViewController.h"
@interface BBTabViewController ()

@end

@implementation BBTabViewController

+(instancetype)TabSingleTon{

    static BBTabViewController *tabVC;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        tabVC = [[BBTabViewController alloc]init];
        
        BBSelfViewController *selfVC = [[BBSelfViewController alloc]init];
        BBYDViewController *selfNavi = [[BBYDViewController alloc]initWithRootViewController:selfVC];
        selfVC.tabBarItem.title = @"我的";
        selfVC.tabBarItem.image = [[UIImage imageNamed:@"self_tab"]imageWithRenderingMode:(UIImageRenderingModeAutomatic)];
        selfVC.tabBarItem.selectedImage = [[UIImage imageNamed:@"self_tab_s"]imageWithRenderingMode:(UIImageRenderingModeAutomatic)];
        
        BBFunctionViewController *functionVC = [BBFunctionViewController new];
        BBYDViewController *funcNavi = [[BBYDViewController alloc]initWithRootViewController:functionVC];
        funcNavi.tabBarItem.title = @"应用宝";
      //  productVC.title = @"产品";
        funcNavi.tabBarItem.image = [[UIImage imageNamed:@"function_tab"]imageWithRenderingMode:(UIImageRenderingModeAlwaysOriginal)];
        funcNavi.tabBarItem.selectedImage = [[UIImage imageNamed:@"function_tab_s"] imageWithRenderingMode:(UIImageRenderingModeAlwaysOriginal)];
        //rootTab.viewControllers = @[EngNavi,productNavi];
        
        [tabVC.tabBarItem setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor colorWithHexString:@"8f8f8f"]} forState:UIControlStateNormal];
        
        tabVC.tabBar.tintColor = [UIColor redColor];
        BBRemindViewController *remindVC = [[BBRemindViewController alloc]init];;
        BBYDViewController *remindNavi = [[BBYDViewController alloc]initWithRootViewController:remindVC];
        remindNavi.tabBarItem.title = @"提醒";
        remindNavi.tabBarItem.image = [[UIImage imageNamed:@"remind_tab"] imageWithRenderingMode:(UIImageRenderingModeAutomatic)];
        remindNavi.tabBarItem.selectedImage = [[UIImage imageNamed:@"remind_tab_s"]imageWithRenderingMode:(UIImageRenderingModeAutomatic)];
        
        BBMSGViewController *msgVC = [[BBMSGViewController alloc]init];
        BBYDViewController *msgNavi = [[BBYDViewController alloc]initWithRootViewController:msgVC];
        msgNavi.tabBarItem.title = @"消息";
        msgNavi.title = @"消息";
        msgNavi.tabBarItem.image = [[UIImage imageNamed:@"msg_tab"]imageWithRenderingMode:(UIImageRenderingModeAutomatic)];
        msgNavi.tabBarItem.selectedImage = [[UIImage imageNamed:@"msg_tab_s"]imageWithRenderingMode:(UIImageRenderingModeAutomatic)];
        
        tabVC.viewControllers = @[msgNavi,remindNavi,funcNavi,selfNavi];
        tabVC.selectedIndex = 0;

    });
    return tabVC;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
